package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 老人用餐统计
 *
 * @author ytche
 * @date 2017年8月30日
 *
 */
@Entity
@Table(name = "tnb_food_plan_record")
@JsonApiResource(type = "foodPlanRecord")
public class FoodPlanRecord extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private Food food;
	private Integer num;
	private Integer diningDate;// 用餐日期
	private Integer recordType;// 0每周 1每天 2按用餐时间(每顿)
	private String position;// 送餐位置
	private Dicttype diningTime;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "food_id")
	public Food getFood() {
		return food;
	}

	public void setFood(Food food) {
		this.food = food;
	}

	@Column(name = "num")
	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	@Column(name = "dining_date")
	public Integer getDiningDate() {
		return diningDate;
	}

	public void setDiningDate(Integer diningDate) {
		this.diningDate = diningDate;
	}

	@Transient
	public Integer getRecordType() {
		return recordType;
	}

	public void setRecordType(Integer recordType) {
		this.recordType = recordType;
	}

	@Transient
	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	@Transient
	public Dicttype getDiningTime() {
		return diningTime;
	}

	public void setDiningTime(Dicttype diningTime) {
		this.diningTime = diningTime;
	}

}
